import {View, Text, ActivityIndicator, StyleSheet} from 'react-native';
import React from 'react';
// import {useSelector, useDispatch} from 'react-redux';
// import {useNavigation} from '@react-navigation/native';
// import {addCount} from '../store/todo.js';

export default function Refresh({
  row = false,
  fullScreen = false,
  content = '正在加载中',
}) {
  // const todos = useSelector(state => state.todos);
  // const dispatch = useDispatch();
  // const navigation = useNavigation();

  // function handlePress() {
  //   dispatch(addCount(1));
  // }

  // function handleDetail() {
  //   navigation.navigate('Detail');
  // }

  return (
    <View
      style={[
        styles.indicatorContainer,
        fullScreen && {flex: 1},
        row && {flexDirection: 'row'},
      ]}>
      <ActivityIndicator style={styles.indicator} />
      <Text>{content}</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  indicatorContainer: {
    alignItems: 'center',
    justifyContent: 'center',
  },
  indicator: {
    color: 'red',
    margin: 10,
  },
});
